import startNodeImg from '@/assets/images/app-management-images/start-node.svg';
import endImg from '@/assets/images/app-management-images/end.svg';
import modelImg from '@/assets/images/app-management-images/model.svg';
import repositoryImg from '@/assets/images/app-management-images/repository.svg';
import questionImg from '@/assets/images/workflow-images/question.svg';
import succeededImg from '@/assets/images/workflow-images/succeeded.svg';
import runningImg from '@/assets/images/workflow-images/running.png';
import failedImg from '@/assets/images/workflow-images/failed.svg';
import branchImg from '@/assets/images/workflow-images/branch.svg';
import parameterImg from '@/assets/images/workflow-images/parameter.svg';
import codeImg from '@/assets/images/workflow-images/code.svg';
import reportImg from '@/assets/images/workflow-images/report.svg';
import qaImg from '@/assets/images/workflow-images/qa.svg';
import iterationImg from '@/assets/images/workflow-images/iteration.svg';
import dataQueryImg from '@/assets/images/workflow-images/data-query.svg';
import chatImg from '@/assets/images/workflow-images/chat.svg';
import {customAlphabet} from 'nanoid';
import {NODES_MAP} from '@/view/graph/model/nodes';

export const nanoId = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);

export enum CategoryGroupType {
    BASE_NODE = 'BaseNode',
    TOOL = 'TOOL',
    WORKFLOW = 'workflow',
    CUSTOM = 'custom'
}

export interface NodeConfig {
    name: string;
    code: NODES_MAP | string;
    img?: any;
    isShow?: boolean;
    tool_id?: number;
    // 输入节点
    input_variables?: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables?: Array<RepositoryOutVariables>;
    iteration_node_id?: string;
}

export const NodeTypeEnum = {
    // 开始
    START: 'start',
    // 知识库
    REPOSITORY: 'knowledge-retrieval',
    // 大模型
    MODEL: 'llm',
    // 图表制作
    QUESTION_CLASS: 'question-classifier',
    // 结束
    END: 'end',
    // 数据查询
    DATA_QUERY: 'sql-tool',
    // 图表制作
    CHAT: 'chart-tool',
    // 条件分支
    CONDITIONAL_BRANCH: 'if-else',
    // 参数提取
    PARAMETER_EXTRACTION: 'parameter-extractor',
    // 代码
    CODE: 'code',
    // 问答
    QA: 'qa',
    // 自定义工具节点
    CUSTOM_TOOL: 'custom-tool',
    // 工作流节点
    WORKFLOW_TOOL: 'workflow-tool',
    // 报告模版节点
    REPORT: 'report',
    // 批处理节点
    ITERATION: 'iteration',
    // 批处理体节点
    ITERATION_BODY: 'iteration_body'
};

export const CategoryGroupList: {
    name: string;
    code: string;
    isFold: boolean;
    children: NodeConfig[];
}[] = [
    {
        name: '基础',
        code: CategoryGroupType.BASE_NODE,
        isFold: true,
        children: [
            {name: '开始', code: NodeTypeEnum.START, img: startNodeImg, isShow: false},
            {name: '大模型', code: NodeTypeEnum.MODEL, img: modelImg, isShow: true},
            {name: '知识库', code: NodeTypeEnum.REPOSITORY, img: repositoryImg, isShow: true},
            {name: '问答', code: NodeTypeEnum.QA, img: qaImg, isShow: true},
            {name: '意图识别', code: NodeTypeEnum.QUESTION_CLASS, img: questionImg, isShow: true},
            {name: '条件判断', code: NodeTypeEnum.CONDITIONAL_BRANCH, img: branchImg, isShow: true},
            {
                name: '参数提取',
                code: NodeTypeEnum.PARAMETER_EXTRACTION,
                img: parameterImg,
                isShow: true
            },
            {name: '代码', code: NodeTypeEnum.CODE, img: codeImg, isShow: true},
            {name: '批处理', code: NodeTypeEnum.ITERATION, img: iterationImg, isShow: true},
            {name: '批处理体', code: NodeTypeEnum.ITERATION_BODY, img: iterationImg, isShow: false},
            {name: '报告', code: NodeTypeEnum.REPORT, img: reportImg, isShow: true},
            {name: '结束', code: NodeTypeEnum.END, img: endImg, isShow: true}
        ]
    },
    {
        name: '内置工具',
        code: CategoryGroupType.TOOL,
        isFold: true,
        children: [
            { name: '数据查询', code: NodeTypeEnum.DATA_QUERY, img: dataQueryImg, isShow: true },
            { name: '图表制作', code: NodeTypeEnum.CHAT, img: chatImg, isShow: true }
        ]
    }
];

export interface BasicTaskInfo {
    // id
    appId: number | null;
    // 名称
    name: string;
    // 组织code
    org_code: string;
    // 组织name
    org_name: string;
    // 省份code
    province_code?: string;
    // 创建人
    created_by?: string;
    // 创建时间
    created_at?: string;
    // 应用介绍
    description: string;
    // 任务状态
    status?: number;
    type?: number;
    org_code_auth: string[];
    org_name_auth: string[];
    req_num?: number;
    wait_time: number;
    is_cache: number;
    cache_time?: number;
    cache_time_power: number;
    workflow_history_round: number;
}

export enum OutputVariableTypeEnum {
    STRING = 'string',
    NUMBER = 'number',
    BOOLEAN = 'boolean',
    OBJECT = 'object',
    ARRAY = 'array',
    ARRAY_OBJECT = 'Array[Object]',
    ARRAY_STRING = 'Array[String]',
    ARRAY_NUMBER = 'Array[Number]',
    ARRAY_BOOLEAN = 'Array[Boolean]'
}

export const VariableList = [
    {name: '文本', value: 'text-input'},
    {name: '下拉单选', value: 'single'},
    {name: '数字', value: 'number-input'},
    {name: '日期', value: 'date'},
    {name: '对象', value: OutputVariableTypeEnum.OBJECT},
    {name: '文件', value: 'file'}
];

export enum VariableTypeEnum {
    TEXT = 'text-input',
    SINGLE = 'single',
    NUMBER = 'number-input',
    DATE = 'date',
    SELECTOR = 'selector',
    OBJECT = 'object',
    FILE = 'file'
}

export type outputType =
    | 'string'
    | 'number'
    | 'boolean'
    | 'object'
    | 'Array[String]'
    | 'Array[Number]'
    | 'Array[Boolean]'
    | 'Array[Object]';

export const InputVariableList = [
    {name: '输入', value: 'text-input'},
    {name: '引用', value: 'selector'}
];

export const OutputVariableTypeList = [
    {name: 'String', value: 'string'},
    {name: 'Number', value: 'number'},
    {name: 'Boolean', value: 'boolean'},
    {name: 'Object', value: 'object'},
    {name: 'Array<String>', value: 'Array[String]'},
    {name: 'Array<Number>', value: 'Array[Number]'},
    {name: 'Array<Boolean>', value: 'Array[Boolean]'},
    {name: 'Array<Object>', value: 'Array[Object]'}
];

export const RequiredTypeEnum = {
    YES: true,
    NO: false
};

/**
 * 开始节点的输入变量
 */
export interface StartNodeInputVariables {
    // 变量名key
    variable: string;
    // 中文名
    label: string;
    // 描述
    description: string;
    // 类型
    type: VariableTypeEnum;
    // 长度限制
    max_length: number;
    // 默认值
    value: string | Array<string>;
    // 是否必填
    required: boolean;
    // 枚举值
    enums: Array<{ key: string; value: string }>;
    id: string;
}

/**
 * 开始节点信息
 */
export interface StartNode {
    input_variables: Array<StartNodeInputVariables>;
}

/**
 * 知识库节点输入信息
 */
export interface RepositoryNodeInputVariables {
    variable: string;
    type: string | undefined;
    value: string | string[];
    uuId: string;
    variableIsDisabled: boolean;
    variableLabel?: string;
    valueLabel?: string;
    id?: string;
    databaseId?: number | null;
    isValue?: boolean;
    variableType?: string;
    is_required?: boolean;
}

/**
 * 知识库配置信息
 */
export interface retrievalConfig {
    // 知识库id
    dataset_id: number | null;
    // 知识库name
    dataset_name: string;
    // 相似度
    LLMInferenceSimilarity: number;
    // 搜索
    searchLimit: number;
    // 召回
    recallLimit: number;
    // id
    uuId: string;
}

export interface RepositoryOutVariables {
    variable: string;
    type: string | undefined;
    schema?: RepositoryOutVariables[];
    desc?: string;
    value?: any;
    id: string;
    description?: string;
}

/**
 * 知识库节点信息
 */
export interface RepositoryNode {
    // 输入变量
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出变量
    out_variables: Array<RepositoryOutVariables>;
    // 知识库参数
    retrieval_config: Array<retrievalConfig>;
    // 搜索参数
    model_retrieval: Array<string>;
}

export type NodeTile = {
    title: string;
    // 节点是否折叠
    isNodeFold: boolean;
    // 编辑按钮是否显示
    isEdieIcon: boolean;
    // 输入是否折叠
    isInputFold: boolean;
    // 输出是否折叠
    isOutFold: boolean;
    // AI模型、知识库是否折叠
    isAiModelFold: boolean;
    // 提示词、搜索参数是否折叠
    isCallWordFold: boolean;
    // 代码是否折叠
    isCodeFold: boolean;
    isExtractParameter: boolean;
    submitFormFunction?: () => void;
    lastModify: Date;
    isClick: boolean;

    // 节点追踪
    nodeTrack?: boolean;
    shape?: string;
    id?: string;
    inputs?: any;
    outputs?: any;
    status?: string;
    error?: string;
    nodeStatus: string;
    isPackUp?: boolean;
};

export interface LlmNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    model: {
        // 模型id
        serviceId: number | null;
        // 温度
        temperature: number;
        // 上下文限制
        rounds: number;
        // 输入上限
        inputMaxToken: number;
        // 回复上线
        maxToken: number;
        // 是否开启思考输出
        enable_think_output?: number;
    };
    prompt_template: Array<{ role: string; text: string }>;
}

export interface EndNode {
    // 类型
    type: number;
    // 输出变量
    out_variables: Array<RepositoryNodeInputVariables>;
    // 是否流式
    stream: boolean;
    // 回复
    reply: string;

    isWatch?: boolean;
}

export interface DataQueryNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    // 数据表
    config: Array<RepositoryNodeInputVariables>;
    // 图表切换
    chart_switch: boolean;
    // 下钻分析
    drill_analysis: boolean;
}

// 图表制作
export interface ChartNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    // 图表类型
    config: Array<RepositoryNodeInputVariables>;
}

export interface CategoryItem {
    desc: string;
    isFold: boolean;
    id: string;
}

// 意图识别
export interface QuestionClassNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    model: {
        serviceId: number | null;
    };
    prompt_template: string;
    category: CategoryItem[];
    isWatch?: boolean;
}

export interface IfElseValues {
    variable: string[] | string;
    comparison_operator: string;
    type: string;
    value: string | string[];
    id: string;
}

// 分支
export interface IfElseNode {
    case_id: string;
    comparison_operator: string;
    values: Array<IfElseValues>;
}

export interface VariableAssignerNode {
    input_variables: Array<RepositoryNodeInputVariables>;
    params_extract: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    model: {
        serviceId: number | null;
    };
    prompt_template: string;
    isWatch?: boolean;
}

// 代码
export interface CodeNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    code: string;
    code_language: string;
    params?: any;
}

//报告模版
export interface ReportNode {
    // 输入节点
    input_variables: Array<RepositoryNodeInputVariables>;
    // 输出节点
    out_variables: Array<RepositoryOutVariables>;
    config: {
        report_name: string;
        file_name: string;
        version_key: string;
        file_url: string;
    };
}

export interface OptionsAnswer {
    content: string;
    option_id: string;
}

export interface QaNode {
    input_variables: Array<RepositoryNodeInputVariables>;
    question: string;
    answer_type: string;
    out_variables: Array<RepositoryOutVariables>;
    options_answer: Array<OptionsAnswer>;
    isWatch?: boolean;
}

export interface ToolNOde {
    input_variables: Array<RepositoryNodeInputVariables>;
    tool_id: number | null;
    out_variables: Array<RepositoryOutVariables>;
}

export interface IterationNode {
    parallel_nums: number | null;
    max_process_data: number | null;
    input_variables: Array<RepositoryNodeInputVariables>;
    out_variables: Array<RepositoryNodeInputVariables>;
}

export interface IterationBodyNode {
    iteration_node_id?: string;
}

export type NodeFormType = Partial<
    StartNode &
    RepositoryNode &
    LlmNode &
    EndNode &
    DataQueryNode &
    ChartNode &
    QuestionClassNode &
    IfElseNode &
    VariableAssignerNode &
    CodeNode &
    QaNode &
    ToolNOde &
    ReportNode &
    IterationNode &
    IterationBodyNode
> &
    NodeTile;

export type EdgeFormType = Partial<QuestionClassEdge>;

export interface QuestionClassEdge {
    type: string;
    categoryId: string;
}

export const WorkFlowStatusEnum = {
    PUBLISH: 1,
    UN_PUBLISHED: 0
};

export const NodeStatusNameEnumType: any = {
    succeeded: '运行成功',
    failed: '运行失败',
    running: '运行中',
    wait_action: '等待用户输入'
};

export const NodeStatusEnumType = {
    SUCCESS: 'succeeded',
    FAILED: 'failed',
    RUNNING: 'running',
    WAIT_ACTION: 'wait_action'
};

export const NodeStatusImg: any = {
    [NodeStatusEnumType.SUCCESS]: succeededImg,
    [NodeStatusEnumType.FAILED]: failedImg,
    [NodeStatusEnumType.RUNNING]: runningImg,
    [NodeStatusEnumType.WAIT_ACTION]: runningImg
};

export const AnswerModeList = [
    {name: '返回变量，由Bot生成回答', value: 0},
    {name: '返回变量，使用设定的内容直接回答', value: 1}
];

export enum EndNodeType {
    // 变量
    VARIATE = AnswerModeList[0].value,
    // 流式
    STREAM = AnswerModeList[1].value
}

export enum ModelRetrieval {
    USE_QUERY = 'useQuery',
    USE_ANSWER = 'useAnswer'
}

export const ModelRetrievalList = [ModelRetrieval.USE_QUERY, ModelRetrieval.USE_ANSWER];

export const DataSourceList = [
    {name: 'MySql', value: 'mysql'},
    {name: 'Hive', value: 'hive'},
    {name: 'ClickHouse', value: 'clickhouse'}
];

export const ChartTypeEnum = {
    LINE: 'line',
    PIE: 'pie',
    BAR: 'bar'
};

export const ChartTypeList = [
    {name: '柱状图', value: ChartTypeEnum.BAR},
    {name: '折线图', value: ChartTypeEnum.LINE},
    {name: '饼图', value: ChartTypeEnum.PIE}
];

export const StartNodeInputVariablesItem: StartNodeInputVariables = {
    variable: '',
    label: '',
    type: VariableTypeEnum.TEXT,
    max_length: 20,
    value: '',
    description: '',
    required: RequiredTypeEnum.YES,
    id: nanoId(),
    enums: [{key: nanoId(), value: ''}]
};

export const InputVariables: RepositoryNodeInputVariables = {
    variable: '',
    type: VariableTypeEnum.SELECTOR,
    value: '',
    uuId: nanoId(),
    variableIsDisabled: false,
    isValue: false,
    id: nanoId(),
    is_required: true
};

export const OutputVariables: RepositoryOutVariables = {
    variable: '',
    type: OutputVariableTypeEnum.STRING,
    id: nanoId()
};

export const RepositoryNodeItem: RepositoryNode = {
    input_variables: [InputVariables],
    out_variables: [
        {variable: 'knowledge_output', type: OutputVariableTypeEnum.OBJECT, id: nanoId()}
    ],
    retrieval_config: [
        {
            dataset_id: null,
            dataset_name: '',
            LLMInferenceSimilarity: 0.8,
            searchLimit: 3,
            recallLimit: 10,
            uuId: nanoId()
        }
    ],
    model_retrieval: [ModelRetrieval.USE_QUERY, ModelRetrieval.USE_ANSWER]
};

export const llmNodeItem: LlmNode = {
    input_variables: [InputVariables],
    out_variables: [{variable: 'llm_output', type: 'string', id: nanoId()}],
    model: {
        serviceId: null,
        temperature: 0,
        rounds: 5,
        inputMaxToken: 2000,
        maxToken: 2000,
        enable_think_output: 0
    },
    prompt_template: [
        {role: 'system', text: ''},
        {role: 'user', text: ''}
    ]
};

export const EndNodeItem: EndNode = {
    type: EndNodeType.VARIATE,
    out_variables: [InputVariables],
    stream: false,
    reply: ''
};

export const DataQueryNodeItem: DataQueryNode = {
    input_variables: [
        {
            variable: 'sql',
            type: 'selector',
            value: '',
            uuId: nanoId(),
            variableIsDisabled: true
        }
    ],
    out_variables: [
        {variable: 'data', type: 'string', id: nanoId()},
        {variable: 'msg', type: 'string', id: nanoId()},
        {variable: 'success', type: 'boolean', id: nanoId()}
    ],
    config: [
        {
            variable: '', // 源类型
            type: '', // 数据库
            value: '', // 数据表
            uuId: nanoId(),
            variableIsDisabled: false,
            databaseId: null
        }
    ],
    chart_switch: false,
    drill_analysis: false
};

export const ChartNodeItem: ChartNode = {
    input_variables: [
        {
            ...InputVariables,
            variable: 'chart_type',
            type: VariableTypeEnum.TEXT,
            value: ChartTypeEnum.BAR
        }
    ],
    out_variables: [
        {variable: 'data', type: 'string', id: nanoId()},
        {variable: 'msg', type: 'string', id: nanoId()},
        {variable: 'success', type: 'boolean', id: nanoId()},
        {variable: 'minio_url', type: 'string', id: nanoId()}
    ],
    config: [
        {
            variable: 'data',
            type: VariableTypeEnum.SELECTOR,
            value: '',
            uuId: nanoId(),
            variableIsDisabled: true,
            variableLabel: '参数名',
            valueLabel: '参数值'
        },
        {
            variable: 'title',
            type: VariableTypeEnum.TEXT,
            value: '',
            uuId: nanoId(),
            variableIsDisabled: true,
            variableLabel: '参数名',
            valueLabel: '参数值'
        },
        {
            variable: 'xAris',
            type: VariableTypeEnum.TEXT,
            value: '',
            uuId: nanoId(),
            variableIsDisabled: true,
            variableLabel: '参数名',
            valueLabel: '参数值'
        },
        {
            variable: 'yAris',
            type: VariableTypeEnum.TEXT,
            value: '',
            uuId: nanoId(),
            variableIsDisabled: true,
            variableLabel: '参数名',
            valueLabel: '参数值'
        }
    ]
};

export const categoryItem = {
    desc: '',
    isFold: false,
    id: nanoId()
};

export const QuestionClassNodeItem: QuestionClassNode = {
    input_variables: [InputVariables],
    out_variables: [{variable: 'classify', type: 'string', id: nanoId()}],
    model: {
        serviceId: null
    },
    prompt_template: '',
    category: [
        categoryItem,
        {
            ...categoryItem,
            desc: '其他'
        }
    ]
};

export const NumberOperatorList = [
    {name: '等于', value: '='},
    {name: '不等于', value: '≠'},
    {name: '大于', value: '>'},
    {name: '大于等于', value: '>='},
    {name: '小于', value: '<'},
    {name: '小于等于', value: '<='},
    {name: '为空', value: 'empty'},
    {name: '不为空', value: 'not_empty'}
];

export const StringOperatorList = [
    {name: '包含', value: 'contains'},
    {name: '不包含', value: 'not_contains'},
    {name: '是', value: 'is'},
    {name: '不是', value: 'is_not'},
    {name: '为空', value: 'empty'},
    {name: '不为空', value: 'not_empty'}
];

export const OperatorTypeEnum = {
    EMPTY: StringOperatorList[4].value,
    NOT_EMPTY: StringOperatorList[5].value
};

export const ComparisonOperator = [
    {name: '且', value: 'and'},
    {name: '或', value: 'or'}
];

export const ComparisonOperatorTypeEnum = {
    AND: ComparisonOperator[0].value,
    OR: ComparisonOperator[1].value
};

export const ParamsExtractType = [
    'String',
    'Number',
    'Dict',
    'Array[String]',
    'Array[Number]',
    'Array[Object]'
];

export const IfElseValueItem = {
    variable: [],
    comparison_operator: '',
    type: VariableTypeEnum.SELECTOR,
    value: '',
    id: nanoId()
};

export const IfElseItem: IfElseNode = {
    case_id: nanoId(),
    comparison_operator: ComparisonOperatorTypeEnum.AND,
    values: [IfElseValueItem]
};

export const VariableAssignerItem: VariableAssignerNode = {
    input_variables: [InputVariables],
    params_extract: [InputVariables],
    out_variables: [],
    model: {
        serviceId: null
    },
    prompt_template: ''
};

export const CaseFormLabel = ['引用变量', '选择条件', '变量类型', '比较值'];

export const ParamsExtractFormLabel = ['参数名', '参数类型', '参数描述'];

export const DataQueryFormLabel = ['源类型', '数据库', '数据表'];

export const QaFormLabel = ['变量名', '变量类型', '变量描述'];

export const CodeNodeItem: CodeNode = {
    input_variables: [
        {
            ...InputVariables,
            variable: 'input'
        }
    ],
    out_variables: [
        {variable: 'key0', type: 'string', value: '', id: nanoId()},
        {variable: 'key1', type: 'array', value: ['hello', 'world'], id: nanoId()},
        {
            variable: 'key2',
            type: 'object',
            value: {
                key21: 'hi'
            },
            id: nanoId()
        }
    ],
    code_language: 'python3',
    code: `def main(input):
    ret = {
        "key0": input,
        "key1": ["hello", "world"],
        "key2": {
            "key21": "hi"
        },
    }

    return ret`
};

export const ReportNodeItem: ReportNode = {
    input_variables: [InputVariables],
    out_variables: [{variable: 'file_url', type: OutputVariableTypeEnum.STRING, id: nanoId()}],
    config: {
        report_name: '',
        file_name: '',
        version_key: '',
        file_url: ''
    }
};

export const AnswerTypeEnum = {
    DIRECT_ANSWER: '1',
    OPTIONAL_ANSWER: '2'
};

export const QaNodeItem: QaNode = {
    input_variables: [InputVariables],
    question: '',
    answer_type: AnswerTypeEnum.DIRECT_ANSWER,
    out_variables: [
        {variable: 'user_response', type: 'string', id: nanoId(), value: '用户本轮输入内容'}
    ],
    options_answer: [
        {
            content: '',
            option_id: nanoId()
        },
        {
            content: '',
            option_id: nanoId()
        },
        {
            content: '',
            option_id: nanoId()
        }
    ]
};

export type GetToolItem = {
    app_id: string;
    org_code: string;
};

export const IterationNodeItem: IterationNode = {
    input_variables: [
        {
            variable: 'index',
            type: VariableTypeEnum.TEXT,
            value: 'index',
            uuId: nanoId(),
            variableIsDisabled: false,
            isValue: false,
            id: nanoId()
        },
        {
            variable: '',
            type: VariableTypeEnum.SELECTOR,
            value: '',
            uuId: nanoId(),
            variableIsDisabled: false,
            isValue: false,
            id: nanoId()
        }
    ],
    out_variables: [InputVariables],
    parallel_nums: null,
    max_process_data: null
};

export const IterationBodyNode: IterationBodyNode = {
    iteration_node_id: ''
};

export const NodeSizeItem = {
    [NodeTypeEnum.START]: {
        width: 350,
        height: 189
    },
    [NodeTypeEnum.MODEL]: {
        width: 536,
        height: 866
    },
    [NodeTypeEnum.REPOSITORY]: {
        width: 632,
        height: 628
    },
    [NodeTypeEnum.QA]: {
        width: 588,
        height: 561
    },
    [NodeTypeEnum.QUESTION_CLASS]: {
        width: 504,
        height: 711
    },
    [NodeTypeEnum.CONDITIONAL_BRANCH]: {
        width: 588,
        height: 370
    },
    [NodeTypeEnum.PARAMETER_EXTRACTION]: {
        width: 588,
        height: 640
    },
    [NodeTypeEnum.CODE]: {
        width: 588,
        height: 732
    },
    [NodeTypeEnum.ITERATION]: {
        width: 536,
        height: 454
    },
    [NodeTypeEnum.ITERATION_BODY]: {
        width: 536,
        height: 400
    },
    [NodeTypeEnum.DATA_QUERY]: {
        width: 588,
        height: 455
    },
    [NodeTypeEnum.CHAT]: {
        width: 588,
        height: 608
    }
};


export const BuiltInVariablesEnum = {
    // 用户输入
    QUERY: 'query',
    // 上传文件列表
    FILE: 'file',
    // 多轮历史
    HISTORYLIST: 'historylist',
    // 自定义知识库
    KB_IDS: 'kb_ids'
};

export const builtInVariables = [
    BuiltInVariablesEnum.QUERY,
    BuiltInVariablesEnum.FILE,
    BuiltInVariablesEnum.HISTORYLIST,
    BuiltInVariablesEnum.KB_IDS
];
